const User = {

  state: sessionStorage.getItem('store') ? JSON.parse(sessionStorage.getItem('store')) : {
    user: {
      username: ''
    }
  },

  getters: {
    getUser(state) {
      return state.user
    }
  },

  mutations: {
    updateUser(state, user) {
      state.user = user
    }
  },

  actions: {
    asyncUpdateUser(content, user) {
      content.commit('updateUser', user)
    }
  }

}

export default User;
